<?php
    @include_once("conn.php");

    $phone = $_GET["phone"];
    if(!$phone){
        $obj = array();
        $obj["status"] = false;
        $obj["msg"] = "请传入完整参数";
        $json = json_encode($obj);
        exit($json);
    }

    $sql = "select * from `userinfo` where phone ='$phone'";

    $result = mysqli_query($conn,$sql);

  
    if(!$result){

        $obj = array();
        $obj["status"] = false;
        $obj["detail"] = "sql语句有误";
        $obj["sql"] = $sql;
        exit(json_encode($obj));
    }

    $item = mysqli_fetch_assoc($result);

    $obj = array();

    if(!$item){
        $obj["status"] = false;
        $obj["msg"] = "可以使用的手机号";
    }else{
        $obj["status"] = true;
        $obj["msg"] = "该手机号已注册";
    }
     
    echo json_encode($obj);
?>